'use strict'

const Service = require('egg').Service

class MinaOrderService extends Service {
    
    async findAll() {
        const { MinaCity } = this.app.model
        return MinaCity.findAll({
            attributes: ['id', 'name', 'postalCode', 'phoneCode']
        })
    }
    
    async findOne(params) {
        const { MinaCity, MinaArea } = this.app.model
        return MinaCity.findOne({
            where: params,
            include: [{
                model: MinaArea,
                where: {
                    flag: 1,
                },
                attributes: ['name', 'flag']
            }]
        })
    }

}

module.exports = MinaOrderService